<div id="tournaments_body_context">
 <div style="margin-top:20px;"><a class="rules_option content_option tournament" style="font-size:20px;" href="<?php echo url_for('@mod_tournament_add') ?>" title="Dodaj turniej"><?php echo image_tag('iAdd.png', array('class' => 'option_img','style'=>'vertical-align:middle')) ?>dodaj</a></div> 
    <table class="content_table">
        <colgroup style="width:48px"></colgroup>
        <colgroup style="width:*"></colgroup>
        <colgroup style="width:130px"></colgroup>
        <colgroup style="width:140px"></colgroup>
        <colgroup style="width:160px"></colgroup>

        <tr id="header">
            <td>#</td>
            <td>Nazwa turnieju</td>
            <td>Status</td>
            <td>Kojarzenie zawodników</td>
            <td>Data modyfikacji</td>
        </tr>
        <?php $i = 12 * ($Page - 1) + 1;
        foreach ($pager->getResult() as $tour):
            ?>
            <tr class="tr_odd">
                <td><?php echo $i++ ?></td>
                <td id="content_name"><a href="<?php echo url_for('@show_tournament?id=' . $tour->getId()) ?>" title="Zobacz turniej"><?php echo image_tag('iBrowse.png', array('class' => 'option_img')) ?><?php echo $tour->getName() ?></a><div id="options">
                        <?php if ($tour->getStatus() == tournament::$GAME_STATUS_START || $tour->getStatus() == tournament::$GAME_STATUS_IDLE): ?>
                            <a class="rules_option content_option tournament" href="<?php echo url_for('@mod_tournament_edit?id=' . $tour->getId()) ?>" title="Edytuj turniej"><?php echo image_tag('iEdit.png', array('class' => 'option_img')) ?>edytuj</a>
                        <?php endif; ?>
    <?php if ($tour->getStatus() == tournament::$GAME_STATUS_START): ?>

                            <a class="rules_option content_option" href="<?php echo url_for('@mod_tournament_play?id=' . $tour->getId()) ?>" title="Rozpocznij turniej"><?php echo image_tag('iBrowse.png', array('class' => 'option_img')) ?>start</a>

                        <?php endif ?>                        

<?php if ($tour->getStatus() == tournament::$GAME_STATUS_PLAYING): ?>

                            <a class="rules_option content_option" href="<?php echo url_for('@mod_tournament_terminate?id=' . $tour->getId()) ?>" title="Przerwij turniej"><?php echo image_tag('iBrowse.png', array('class' => 'option_img')) ?>przerwij</a>

                        <?php endif ?>                        
                            
                            
    <?php if ($tour->getStatus() == tournament::$GAME_STATUS_IDLE): ?>

                            <a class="rules_option content_option rule_add" href="<?php echo url_for('@mod_tournament_activate?id=' . $tour->getId()) ?>" title="Rozpocznij zapisy na turniej"><?php echo image_tag('iBrowse.png', array('class' => 'option_img')) ?>zapisy</a>

                            <a class="rules_option content_option rule_delete" href="<?php echo url_for('@mod_tournament_delete?id=' . $tour->getId()) ?>" title="Usuń turniej"><?php echo image_tag('iDel.png', array('class' => 'option_img')) ?>usuń</a>

    <?php endif ?>
    <?php if ($tour->getStatus() == tournament::$GAME_STATUS_ENDED): ?>
                     <a class="rules_option content_option rule_delete" href="<?php echo url_for('@mod_tournament_delete?id=' . $tour->getId()) ?>" title="Usuń turniej"><?php echo image_tag('iDel.png', array('class' => 'option_img')) ?>usuń</a>       
     <?php endif ?>
                   <a class="rules_option content_option" href="<?php echo url_for('@mod_copy_tournament?id=' . $tour->getId()) ?>" title="Kopiuj turniej"><?php echo image_tag('iAdd.png', array('class' => 'option_img')) ?>kopiuj</a>  
                     
                     
                    </div></td>
                <td><?php
    switch ($tour->getStatus()) {
        case 0:
            echo "nowo utworzony";
            break;
        case 1:
            echo "w trakcie zapisów";
            break;
        case 2:
            echo "zakończony";
            break;
        case 3:
            echo "w trakcie gry";
            break;
    }
    ?></td>
                <td><?php
    switch ($tour->getType()) {
        case 0:
            echo "losowe";
            break;
        case 1:
            echo "każdy z każdym";
            break;
        case 2:
            echo "system szwajcarski";
            break;
    }
    ?></td>	
                <td><?php echo $tour->getUpdatedAt('d.m.Y H:i') ?></td>
            </tr>
<?php endforeach ?>
        <tr>
            <td colspan="5" id="footer">

                <div class="pagination_small">
                    <?php if ($pager->getTotalPages() > 1): ?>
                        <?php if ($link = $pager->getPrev()): ?>
                            <?php echo link_to('« ', url_for('@mod_tournament' . '?page=' . $link)) ?>
                        <?php endif ?>

                        <?php foreach ($pager->getPrevLinks() as $link): ?>
                            <?php echo link_to($link, url_for('@mod_tournament' . '?page=' . $link)) ?>
                        <?php endforeach ?>

                        <?php echo $pager->getPage() ?>

                        <?php foreach ($pager->getNextLinks() as $link): ?>
                            <?php echo link_to($link, url_for('@mod_tournament' . '?page=' . $link)) ?>
                        <?php endforeach ?>

                        <?php if ($link = $pager->getNext()): ?>
                            <?php echo link_to(' »', url_for('@mod_tournament' . '?page=' . $link)) ?>
                        <?php endif ?>

<?php endif; ?>
                </div>	

            </td>
        </tr>
    </table>
</div>